package com.lagou.rabbitmq.vo;

import java.util.Map;

/**
 * @className: R
 * @auther: Jerry
 * @date: 2021/3/17 22:36
 * @desctiption: TODO
 * @version: 1.0
 */
public class R {

    private int code;
    private String msg;
    private Object data;
    private static final String OK = "ok";
    private static final int RES_OK = 0;
    private static final int RES_ERROR = 500;

    public static R ok() {
        R r = new R();
        r.setCode(RES_OK);
        r.setMsg(OK);
        return r;
    }

    public static R ok(Object data) {
        R r = new R();
        r.setCode(RES_OK);
        r.setData(data);
        r.setMsg(OK);
        return r;
    }

    public static R error(String msg) {
        R r = new R();
        r.setCode(RES_ERROR);
        r.setMsg(msg);
        return r;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
